#pragma once
#include "InputSystem.h"

namespace Input{
	class DirectInputInitParams : public InputInitParams{
	public:
		HINSTANCE	m_hinst;
		HWND		m_hwnd;
	};

	class DirectInputSystem : public InputSystem{
	public:
		DirectInputSystem();
		~DirectInputSystem();

		void initialize(boost::shared_ptr<InputInitParams> inputParams);

		void update();
	private:
		inline DWORD translateKey(KeyDefinition key);
		void cleanup();

		void processMouseInput(DIDEVICEOBJECTDATA &data);
		void processKeyboardInput(DIDEVICEOBJECTDATA &data);
	private:
		IDirectInput8		*m_inputDevice;
		IDirectInputDevice8	*m_keyboardDevice,
							*m_mouseDevice;

		std::map<DWORD,KeyDefinition> m_keyTranslateMap;

		LONG m_lastX, m_lastY, m_lastZ;
	};
}